<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<link rel="Stylesheet" type="text/css"
		href="../../componentes/estilos/estilo.css" />

</h:head>

<p:panelGrid columns="2" id="panelGridProp">
	<f:facet name="header">Dados do Proprietario</f:facet>
	<h:outputLabel value="Nome:" />
	<h:outputLabel value="RG:" />
	<p:inputText size="40" value="#{proprietarioMB.proprietario.nome}"
		styleClass="inputForms" />
	<p:inputMask size="40" mask="99999999"
		value="#{proprietarioMB.proprietario.rg}" />

	<h:outputLabel value="Orgão emissor:" />
	<h:outputLabel value="CPF:" />
	<p:inputText size="40"
		value="#{proprietarioMB.proprietario.orgaoEmissor}" />
	<p:inputMask size="40" mask="99999999999"
		value="#{proprietarioMB.proprietario.cpf}" maxlength="14"
		requiredMessage="Informe o CPF">
	</p:inputMask>


	<h:outputLabel value="Endereço:" />
	<h:outputLabel value="Numero: " />
	<p:inputText size="40"
		value="#{proprietarioMB.endereco.rua}" />
	<p:inputText size="40"
		value="#{proprietarioMB.endereco.numero}" />

	<h:outputLabel value="Bairro: " />
	<h:outputLabel value="Complemento: " />
	<p:inputText size="40"
		value="#{proprietarioMB.endereco.bairro}" />
	<p:inputText size="40"
		value="#{proprietarioMB.endereco.complemento}" />

	<h:outputLabel value="Estado: " />
	<h:outputLabel value="CEP: " />

	<p:selectOneMenu value="#{proprietarioMB.estado.id}"
		id="idSelectEstado">
		<f:selectItem itemLabel="SÃO PAULO" itemValue="26" />
		<f:selectItems value="#{proprietarioMB.listarEstados()}" var="estado"
			itemLabel="#{estado.nome}" itemValue="#{estado.id}" />

		<p:ajax update="idSelectCidade"
			listener="#{proprietarioMB.atualizarCidades()}" />
	</p:selectOneMenu>

	<p:inputText size="40"
		value="#{proprietarioMB.proprietario.endereco.cep}" maxlength="8" />

	<h:outputLabel value="Cidade: " />
	<h:outputLabel value="e-mail: " />

	<p:selectOneMenu id="idSelectCidade"
		value="#{proprietarioMB.cidade.id}" >
		<f:selectItems value="#{proprietarioMB.cidades}"
			var="cidade" itemLabel="#{cidade.nome}" itemValue="#{cidade.id}" />
	</p:selectOneMenu>

	<p:inputText size="40" />

	<p:panelGrid columns="4">
		<h:outputLabel value="DDD" />
		
		<p:inputMask size="2" mask="99"
			value="#{proprietarioMB.proprietario.telefones[0].ddd}" />
		
		<h:outputLabel value="Telefone" />
		<p:inputMask size="9" mask="9999-9999"
			value="#{proprietarioMB.proprietario.telefones[0].numero}" />
	</p:panelGrid>

	<p:panelGrid columns="2">
			<p:commandButton value="Avançar"
			action="#{navBean.requestPage('questionarios/questionario-geral/formGerenciaPropriedade.xhtml')}"
			actionListener="#{proprietarioMB.inserirProprietario}" type="submit"
			update="frCentral" ajax="true">
		</p:commandButton>
		<p:commandButton value="Atualizar" rendered="false"
			action="#{proprietarioMB.popularProprietario}" update="frCentral"
			ajax="true" widgetVar="btnAtualizar">
		</p:commandButton>
	</p:panelGrid>

	
</p:panelGrid>

</html>